
def main():
    #code here
    n = int(input())
    def f(num):
        ans = 0
        for c in num:
            ans += int(c) % 3
        return ans % 3
    nums = list(map(f,input().split()))
    hash_map = [0,0,0]
    ans = 0
    for num in nums:
        hash_map[num] += 1
    if hash_map[0] & 1:
        ans += (hash_map[0] - 1) >> 1
    else:
        ans += hash_map[0] >> 1
    ans += min(hash_map[1],hash_map[2])
    print(ans)


if __name__ == '__main__':
    main()